-
Notifications
You must be signed in to change notification settings - Fork 421
feat(logger): new stack_trace field with rich exception details #3147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @stevrobu! Thanks for submitting this PR, this is an amazing first contribution! We need to change a few things before merging this.
One thing I'm missing is the include_stacktrace
parameter in the Logger instance. I see you added it in PowertoolsFormatter
, but I think we can improve the user experience by adding the Logger class in the same way. You can keep this parameter in PowertoolsFormatter
because someone can use the Formatter class in some special cases, but adding this in the Logger class improves the experience.
from aws_lambda_powertools import Logger
logger = Logger(include_stacktrace=True)
@leandrodamascena : I will add the parameter to the logger as you suggested. It actually already works that way because any of the kwargs from the Logger class initialization are passed to the formatter in the structure_logs method. I actually didn't realize this until I wrote a test prior to making the update and the test passed. I've updated the tests so that the linter does not complain and I'm checking out the other suggestions. |
Hi @stevrobu! I think you need to push your local commits, right? I can't see the new code. |
I have not finished yet. I should be able to push tomorrow.
On Oct 3, 2023 5:58 PM, Leandro Damascena ***@***.***> wrote:
@leandrodamascena<https://github.com/leandrodamascena> : I will add the parameter to the logger as you suggested. It actually already works that way because any of the kwargs from the Logger class initialization are passed to the formatter in the structure_logs method. I actually didn't realize this until I wrote a test prior to making the update and the test passed.
I've updated the tests so that the linter does not complain and I'm checking out the other suggestions.
Hi @stevrobu<https://github.com/stevrobu>! I think you need to push your local commits, right? I can't see the new code.
—
Reply to this email directly, view it on GitHub<#3147 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A35SEV6LDS47Z52LSODPJRLX5SDAPAVCNFSM6AAAAAA5LQEGF6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBVG44TCMJRHE>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Aaa, sorry for my mistake. I saw you resolve conversations and assumed you made the commits. No rush, take your time. |
@leandrodamascena - I have checked in the latest updates. Thanks for the feedback! |
Codecov ReportAll modified lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## develop #3147 +/- ##
========================================
Coverage 95.95% 95.96%
========================================
Files 195 195
Lines 8364 8381 +17
Branches 1559 1562 +3
========================================
+ Hits 8026 8043 +17
Misses 276 276
Partials 62 62
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @heitorlessa can you pls review this PR?
For me, it is approved! Amazing work @stevrobu! 🚀
Looking at this now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments and questions, but overall looks good!
Kudos, SonarCloud Quality Gate passed! |
Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience! |
Issue number: #1268
Summary
Changes
Added environment variable and formatter constructor parameter to allow users to include additional JSON formatted full stack trace to their logger.exception output.
To test the change, the following Lambda code will enable the enhanced stacktrace and log the exception along with the stacktrace:
Response in CloudWatch logs should be:
User experience
User can now parse JSON stacktraces instead of string stacktraces.
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Is this a breaking change?
Not a breaking change.
RFC issue number:
Checklist:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.